package com.xiaowu.controller;

import com.xiaowu.pojo.Communit;
import com.xiaowu.pojo.Result;
import com.xiaowu.service.CommunitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@Slf4j
@RestController
public class CommunitController {
    @Autowired //将Service层的对象注入到Controller层
    private CommunitService cs;     //面向接口编程

    @GetMapping("/boatlist")
    public Result boatlist(){
        log.info("查询全部数据");
        List<Communit> list= cs.boatlist();
        return Result.success(list);
    }

    @GetMapping("/cyclelist")
    public Result cyclelist(){
        log.info("查询全部数据");
        List<Communit> list= cs.cyclelist();
        return Result.success(list);
    }

    @GetMapping("/healthlist")
    public Result healthlist(){
        log.info("查询全部数据");
        List<Communit> list= cs.healthlist();
        return Result.success(list);
    }

    @GetMapping("/etmlist")
    public Result etmlist(){
        log.info("查询全部数据");
        List<Communit> list= cs.etmlist();
        return Result.success(list);
    }

    @GetMapping("/medicallist")
    public Result medicallist(){
        log.info("查询全部数据");
        List<Communit> list= cs.medicallist();
        return Result.success(list);
    }

    @GetMapping("/climbllist")
    public Result climbllist(){
        log.info("查询全部数据");
        List<Communit> list= cs.climbllist();
        return Result.success(list);
    }

    @GetMapping("/moivellist")
    public Result moivellist(){
        log.info("查询全部数据");
        List<Communit> list= cs.moivellist();
        return Result.success(list);
    }

    @GetMapping("/driverllist")
    public Result driverllist(){
        log.info("查询全部数据");
        List<Communit> list= cs.driverllist();
        return Result.success(list);
    }
}
